package requests

import (
	dtos "github.com/edgexfoundry/edgex-go/internal/app/dtos"
	"github.com/edgexfoundry/edgex-go/internal/app/dtos/common"
	"github.com/edgexfoundry/edgex-go/internal/app/models"
)

type AddProductRequest struct {
	common.BaseRequest `json:",inline"`
	Product            dtos.Product `json:"product"`
}

type UpdateProductRequest struct {
	common.BaseRequest `json:",inline"`
	Product            dtos.Product `json:"product"`
}

func AddProductReqToProductModels(AddProductRequests []AddProductRequest) (Products []models.Product) {
	for _, req := range AddProductRequests {
		p := dtos.ToProductModel(req.Product)
		Products = append(Products, p)
	}
	return Products
}
